Page({
  onLoad(e){
    this.getData(e.id)
  },
  async getData(id){
    let {data} =  await wx.http({
      url:'/visitor/'+id
    })
    this.setData({
      ...data
    })
  },

  // 特别生命周期：监听用户分享动作
  onShareAppMessage() {
    return {
      title: '查看通行证',
      path: '/visitor_pkg/pages/passport/index?id=' + this.data.id ,
      imageUrl: 'https://enjoy-plus.oss-cn-beijing.aliyuncs.com/images/share_poster.png',
    }
  },

  // 
  async saveImg(){
    // 1、图片信息
    let {path} = await wx.getImageInfo({src:this.data.url})

    // 2、保存到本地
    await wx.saveImageToPhotosAlbum({filePath: path});  
  }
})
